package api

import (
	"bufio"
	"encoding/json"
	"go-bff-scaffold/dto"
	"os"
)

func ParseAppGlobal(path string) (*dto.AppGlobal, error) {
	var appGlobal *dto.AppGlobal = &dto.AppGlobal{}
	file, error := os.Open(path)
	if error != nil {
		panic(error)
	}
	defer file.Close()
	reader := bufio.NewReader(file)
	decoder := json.NewDecoder(reader)
	if error = decoder.Decode(appGlobal); error != nil {
		return nil, error
	}
	return appGlobal, nil
}
